package P104_ForName;

import org.junit.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 使用forName动态加载类文件
 */
public class ForName {

    @Test
    public void Test() throws ClassNotFoundException {
        Class.forName("P104_ForName.Util");
    }

    void demo() throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.cj.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/db";
        Connection connection = DriverManager.getConnection(url);
        Statement statement = connection.createStatement();
    }
}
